package com.chb.app.controller;

import com.chb.app.service.PayService;
import com.chb.app.vo.PayDto;
import com.hos.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author: 陈海彬
 * @date: Created in 2023/12/22 11:46
 * @description: 支付控制层
 * @modified By:
 * @version: 1.0
 */
@RestController
@RequestMapping("/app/pay")
@Api(tags = "订单支付相关控制层")
public class PayController {

    @Resource
    private PayService payService;

    @GetMapping("mock/{orderId}")
    @ApiOperation("模拟支付-内测版-创建订单")
    public Result<Void> getPayMock(@PathVariable String orderId) {
        this.payService.getPayMock(orderId);
        return new Result<>(200, "支付成功", null);
    }

    @PostMapping("wxPay/{chId}")
    @ApiOperation("支付-微信支付")
    public Result<PayDto> wxPay(@PathVariable String chId) {
        return this.payService.wxPay(chId);
    }

    @PostMapping("queryWxPayStatus/{chId}")
    @ApiOperation("查询支付状态--微信支付")
    public Result<String> queryWxPayStatus(@PathVariable String chId) {
        return this.payService.queryWxPayStatus(chId);
    }
}